package com.yricky.indesk

import android.app.Application
import android.content.IntentFilter
import com.yricky.indesk.a.receiver.PkgEventReceiver
import com.yricky.indesk.model.AppConfig
import com.yricky.indesk.utils.cfgChannel
import android.content.Intent
import com.yricky.indesk.a.receiver.TimeTickReceiver
import com.yricky.indesk.utils.PkgEvent
import com.yricky.indesk.utils.pkgChannel
import me.yricky.event.Audience


/**
 * @author Yricky
 * @date 2021/12/26
 */
class IndeskApp:Application() {
    companion object{
        lateinit var inst:IndeskApp
            private set
    }
    val appConfig:AppConfig by lazy {
        AppConfig(getExternalFilesDir("cfg")!!)
    }

    override fun onCreate() {
        super.onCreate()
        inst = this
        pkgChannel.register(appConfig.audience)
        PkgEventReceiver().init(this)
        TimeTickReceiver().init(this)
    }
}

val app:IndeskApp = IndeskApp.inst